home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_sol_chase1doors.cog < prev    next >
Text File  |  1999-11-15  |  6KB  |  229 lines

  1. # Jones 3D Cog Script
  2. #
  3. # SOL_MineSftyDoors.cog
  4. #
  5. # [TRM]
  6. #
  7. # (C) 1999 LucasArts Entertainment Co. All Rights Reserved
  8. # ========================================================================================
  9.  
  10. symbols
  11.  
  12.     message     startup
  13.     message     user0
  14.     message     entered
  15.     message     activated
  16.     message     blocked
  17.  
  18.     thing       car             local
  19.     thing       player          local
  20.     thing       doorL                              
  21.     thing       doorR
  22.     sector      doorSector      nolink
  23.  
  24.     surface     open            mask=0x404
  25.     surface     close           mask=0x404
  26.     
  27.     sound       sndOpen=sol_cardoor_open_c.wav      local
  28.     sound       sndClose=sol_cardoor_close_c.wav    local
  29.     
  30.     sound        fireSafety=pr15j01.wav        local   # Horner must have been worried...
  31.     sound       in_Line0=Pr15j02.wav        local   # The fire door only opens...
  32.     sound       in_Line1=Inxj096.wav        local   # I can't open it.
  33.     
  34.     vector      color           local
  35.     
  36.     flex        dist=0.2
  37.     flex        R=0.3
  38.     flex        G=0.3
  39.     flex        B=0.35
  40.     
  41.     int         doorsOpen=0        local
  42.     int         sender            local
  43.     int         sound1          local
  44.     int         newComment      local
  45.     int         oldComment      local
  46.     int         playing=0       local
  47.     
  48.     int         chase1Wait=0    local
  49.     int         randNum         local
  50.     
  51.     # ** subroutines **
  52.     flex        doorLine        local
  53.         
  54. end
  55.  
  56. # ========================================================================================
  57. code
  58.  
  59. startup:
  60.  
  61.     SectorAdjoins(doorSector, 0);
  62.     color = VectorSet(R, G, B);
  63.     SetThingLight(doorL, color, dist, 0.1);
  64.     SetThingLight(doorR, color, dist, 0.1);
  65.     
  66.     return;
  67.         
  68. # ========================================================================================
  69.  
  70. user0:
  71.  
  72.     chase1Wait = 1;
  73.     return;
  74.     
  75. # ========================================================================================
  76.       
  77. entered:
  78.         
  79.     sender = GetSenderRef();
  80.     car = GetSourceRef();
  81.  
  82.     if(BitTest(GetPhysicsFlags(car), 0x01000000))
  83.     {
  84.         if(sender == open)
  85.         {
  86.             # turn on adjoin, remove door collisions
  87.             SectorAdjoins(doorSector, 1);
  88.             SetCollideType(doorL, 0);
  89.             SetCollideType(doorR, 0);
  90.             
  91.             # play door sounds
  92.             if(doorsOpen == 0)
  93.             {
  94.                 sound1 = PlaySoundThing(sndOpen, doorL, 0.5, 10.0, 20.0, 0);
  95.                 PlaySoundThing(sndOpen, doorR, 0.5, 10.0, 20.0, 0);
  96.             }
  97.             
  98.             # open the doors
  99.             MoveToFrame(doorL, 1, 2.0);
  100.             MoveToFrame(doorR, 1, 2.0);
  101.             #WaitForStop(doorL);
  102.             doorsOpen = 1;
  103.         }
  104.     
  105.         if(sender == close)
  106.         {
  107.             if(doorsOpen == 1)
  108.             {
  109.                 WaitForStop(doorL);
  110.                 WaitForSound(sound1, 0.0);
  111.                 
  112.                 if(chase1Wait == 1)
  113.                 {
  114.                     #Print("chase1Doors: waiting");
  115.                     Sleep(5.0);
  116.                     chase1Wait = 0;
  117.                 }
  118.                 
  119.                 # play door sounds
  120.                 PlaySoundThing(sndClose, doorL, 0.5, 10.0, 20.0, 0);
  121.                 PlaySoundThing(sndClose, doorR, 0.5, 10.0, 20.0, 0);
  122.                 
  123.                 # close the doors
  124.                 MoveToFrame(doorL, 0, 1.0);
  125.                 MoveToFrame(doorR, 0, 1.0);
  126.                 
  127.                 # turn off adjoin, reset collisions
  128.                 WaitForStop(doorL);
  129.                 SetCollideType(doorL, 1);
  130.                 SetCollideType(doorR, 1);
  131.                 Sleep(1.0);
  132.                 SectorAdjoins(doorSector, 0);
  133.                 doorsOpen = 0;
  134.             }
  135.         }
  136.     }
  137.         
  138.     return;
  139.  
  140. # ========================================================================================
  141.  
  142. activated:
  143.  
  144.     Print("Activated: Mine Doors");
  145.  
  146.     player = GetLocalPlayerThing();
  147.  
  148.     while (newComment == oldComment) 
  149.     {
  150.         newComment = RandBetween(0, 1);
  151.     }
  152.     
  153.     oldComment = newComment;
  154.     randNum = RandBetween(0, 9);
  155.     
  156.     if((GetSenderRef() == doorL) || (GetSenderRef() == doorR))
  157.     {
  158.         if(playing == 0)
  159.         {
  160.             playing = 1;
  161.             Call doorLine;
  162.         }
  163.     }
  164.  
  165.     return;
  166.  
  167. # ========================================================================================
  168.  
  169. doorLine:
  170.  
  171.     # do cutscene stuff
  172.     MakeMeStop();
  173.     StartCutscene(0);
  174.     
  175.     # offset camera and nudge the door
  176.     SetExtCamOffset('0.1 0.0 0.065');
  177.     PlayMode(player, 60, 0);
  178.     Sleep(0.3);
  179.     
  180.     # put away any weapon
  181.     DeselectWeaponWait(player);
  182.     
  183.     # player never activated door in PYR
  184.     if(global12 == 0)
  185.     {
  186.         PlayVoice(player, fireSafety, 1.0, 1);
  187.         global12 = 1;
  188.     }
  189.     
  190.     # player activated door in PYR
  191.     else if(global12 == 1)
  192.     {
  193.         if(randNum == 5)
  194.         {
  195.             PlayVoice(player, fireSafety, 1.0, 1);
  196.         }
  197.         
  198.         else
  199.         {
  200.             PlayVoice(player, in_Line0[newComment], 1.0, 1);
  201.         }
  202.     }
  203.     
  204.     RestoreExtCam();
  205.     ClearActorFlags(player, 0x200000);
  206.     EndCutscene();
  207.     
  208.     playing = 0;
  209.     
  210.     return;
  211.     
  212. # ========================================================================================
  213.  
  214. blocked:
  215.  
  216.     Print("chase1doors: blocked");
  217.     #SectorAdjoins(doorSector, 1);
  218.     #sound1 = PlaySoundThing(sndOpen, doorL, 0.5, 10.0, 20.0, 0);
  219.     #PlaySoundThing(sndOpen, doorR, 0.5, 10.0, 20.0, 0);
  220.     #MoveToFrame(doorL, 1, 2.0);
  221.     #MoveToFrame(doorR, 1, 2.0);
  222.  
  223.     return;
  224.     
  225. # ========================================================================================
  226.  
  227. end
  228.  
  229.